-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Properly handle Never
type argument to Capabilities.get
#3203
Conversation
Cadence Benchstat comparisonThis branch with compared with the base branch onflow:master commit 468b11b Collapsed results for better readability
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for looking into this!
We can definitely merge this fix, but maybe also want to improve this further: Currently Never
is only rejected at run-time, we maybe want to already reject this statically.
We currently do not have the means in the language to express the constraint that the type parameter should have a lower bound. However, we have a mechanism for it in the checker: FunctionType.TypeArgumentsCheck
. Maybe extend this solution by adding such a static check (potentially in a separate PR).
We have a similar case in / report for revertibleRandom
, see https://github.com/dapperlabs/cadence-internal/issues/188. In a comment of the issue I noted how it would be nice to extend the type bounds to express this in a way where it is also communicated to users: https://github.com/dapperlabs/cadence-internal/issues/188#issuecomment-1906752366. I had opened #3059 a while back with a PoC of this idea, maybe have a look, I'd love to hear your thoughts!
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3203 +/- ##
==========================================
+ Coverage 80.68% 80.70% +0.01%
==========================================
Files 380 380
Lines 93183 93209 +26
==========================================
+ Hits 75188 75226 +38
+ Misses 15290 15278 -12
Partials 2705 2705
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Yeah this makes sense. What is left to do on #3059? I can pick this up |
@dsainati1 sounds good! I tried to leave TODOs in both the PR description (see tasklist) as well as in the code. We can maybe discuss it in the next Impl. Sync |
Closes https://github.com/dapperlabs/cadence-internal/issues/176
Properly return a
nil
value in this case rather than panicking.master
branchFiles changed
in the Github PR explorer